<template>
    <aside>
        <div class="fc-logo">MJUI</div>
        <div class="layer-layout-sidebar-scroll">
            <ul class="fc-nav">
                <template v-for="(item,index) in navlist">
                    <li :class="{'open':item.open}" :key="item.name">
                        <a href="javascript:;" @click="onClick(item,index)">{{item.name}}</a>
                        <ol v-show="item.open">
                            <li v-for="(d) in item.children" :key="d.to">
                                <router-link :to="d.to">{{d.title}}</router-link>
                            </li>
                        </ol>
                    </li>
                </template>
            </ul>
        </div>
    </aside>
</template>
<script>
import nav from '@/api/nav.js'

export default {
    data() {
        return {
            navlist: nav.data, //侧栏导航数据
            navItem: [], //侧栏导航key
        }
    },
    mounted() {
        // console.log(this.navlist)
    },
    methods: {
        onClick(item, index) {
            item.open = !item.open
        }
    }
}
</script>
